#ifndef ACTIVATION_THREAD_KMS_H
#define ACTIVATION_THREAD_KMS_H

#include <QObject>
#include <QThread>
#include <stdio.h>
#include <stdlib.h>
#include <string>
//#include <QUdpSocket>
#include <QtNetwork>
#include <QTimer>
#include <QMessageBox>
#include "receive_dbus.h"
#include "definition.h"
#include "socketmanager.h"
#include "getconnectconfig.h"
#include <QSettings>
#include <QDir>
#include <QFileInfo>
#include <QFile>
#include <QTextStream>
#include <QNetworkRequest>
#include <QHostInfo>
#include <QStringListIterator>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

extern "C" {
extern int encrypt_hardware_info(const char* hw_info, unsigned int in_size, unsigned char* out, unsigned int *out_size);
}

#define UEVENT_BUFFER_SIZE 2048

class activation_thread_kms : public QThread
{
    Q_OBJECT
public:
    explicit activation_thread_kms(QObject *parent = 0);
    void init_udpinfo();
    QNetworkAccessManager *m_accessManager_Registered = new QNetworkAccessManager();
    void oemActivate();

    QTimer *timer;
    bool isCloudPlatform = false;

public slots:
    void sendudp();
    void receiveudp();
    void receivetcp();
//    int finishedSlot_info(QNetworkReply *registered);
    void init_activation_profile();
    void refresh_activation_profile();
    void refresh_activation_code(QString);
    void refresh_activation_conf();
    void generate_udp_send_info();

signals:
    void activation_message_signal(int activation);

    void activation_post_signal( QString info);

    void activation_get_server(QHostAddress, int);

private:
    void run();
    int port, host_port;
    bool isStarted, default_check = true,_CodeOrProfile=false;
    QString udp_send_info, tcp_send_info, register_number, serial_number, server_dns, server_ip, current_active, activation_interval, retry_count, initial_interval, offset_value;
    QUdpSocket *udpSocket;
    QHostAddress hostAddress;
    QTcpSocket *tcpSocket;
    getconnectconfig *conconf;
    static int broadcast_cnt;

//signals:


};

#endif // ACTIVATION_THREAD_KMS_H


